#include <iostream>
using namespace std;

void swap(float &a, float &b) {
    float temp = a;
    a = b;
    b = temp;
}

void findMinAndSecondMin(int start, int end, float arr[], float &minVal, float &secondMinVal) {
    if (start == end) {
        minVal = secondMinVal = arr[start];
        return;
    }

    if (end - start == 1) {
        if (arr[start] < arr[end]) {
            minVal = arr[start];
            secondMinVal = arr[end];
        } else {
            minVal = arr[end];
            secondMinVal = arr[start];
        }
        return;
    }

    int mid = (start + end) / 2;
    float leftMin, leftSecondMin;
    findMinAndSecondMin(start, mid, arr, leftMin, leftSecondMin);

    float rightMin, rightSecondMin;
    findMinAndSecondMin(mid + 1, end, arr, rightMin, rightSecondMin);

    if (leftMin < rightMin) {
        minVal = leftMin;
        if (rightMin < leftSecondMin) {
            secondMinVal = rightMin;
        } else {
            secondMinVal = leftSecondMin;
        }
    } else {
        minVal = rightMin;
        if (leftMin < rightSecondMin) {
            secondMinVal = leftMin;
        } else {
            secondMinVal = rightSecondMin;
        }
    }
}

int main() {
    int n;
    cout << "请输入数字的个数: ";
    cin >> n;

    float arr[100];
    cout << "请依次输入 " << n << " 个数字: ";
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }

    float minVal, secondMinVal;
    findMinAndSecondMin(0, n - 1, arr, minVal, secondMinVal);

    cout << "这组数字中第二小的数是: " << secondMinVal << endl;

    return 0;
}